<?
include 'conexion.php';
    extract($_POST);
    extract($_GET);
	//$base= "ucg - copia";
		$tabla = "pago";
	//$conexion=mysql_connect("localhost","root","");
	//mysql_select_db($base,$conexion);
	$resultado=mysql_query("SELECT * FROM $tabla WHERE cod_p=$Modificar",$conexion);
	$registro = mysql_fetch_row($resultado);	
	
	$r=mysql_query("SELECT sum(monto_s) FROM  id_pago WHERE cod_p='$registro[0]'",$conexion);

	$credito= mysql_fetch_row($r);
	$cred= number_format($credito[0],2,",",".");	
	
	$rf=mysql_query("SELECT factura FROM  id_pago WHERE cod_p='$registro[0]' group by factura",$conexion);

		?>
<title>Reporte Orden de Pago</title>
<style type="text/css">
<!--
.Estilo1 {
	color: #000000
}
body, td, th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000000;
}
body {
	background-color: #FFFFFF;
}
a {
	font-family: Courier New, Courier, mono;
	font-size: 14px;
	color: #000000;
}
a:visited {
	color: #000000;
}
a:hover {
	color: #000000;
}
a:active {
	color: #999999;
}
-->
</style>
<link href="boton.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
@import url("tablas.css");
a:link {
	color: #000000;
}
.style3 {
	font-size: 10px;
	font-weight: bold;
}
.style4 {
	font-size: 12px
}
.style10 {
	font-size: 14px
}
.style11 {
	font-size: 14px;
	font-weight: bold;
}
.style14 {
	font-size: 10px
}
.style8 {
	font-size: 10
}
-->
</style>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="100%">
  <tr bordercolor="#FFFFFF">
    <td width="16%">&nbsp;</td>
    <td width="16%">&nbsp;</td>
    <td width="17%">&nbsp;</td>
    <td width="30%">&nbsp;</td>
    <td width="21%"><span class="style11 style14 style14">*<? echo $cred; ?>*</span></td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td colspan="2"><div align="center" class="style11"><span class="style14"><span class="style14"></span></span></div></td>
    <td class="style10"><span class="style14">
      <? $resul=mysql_query("SELECT emp FROM proveedor WHERE rif='$registro[6]'",$conexion);
	$regis = mysql_fetch_row($resul); echo $regis[0];?>
    </span></td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td colspan="2"><div align="center" class="style11 style14 style14"></div>
      <div align="center" class="style11 style14 style14"></div></td>
    <td><span class="style11 style14 style14">*<? echo $cred; ?>*</span></td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="2"><span class="style10 style14 style14"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;M&Eacute;RIDA, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<? echo "$registro[5]";?></span></td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="2"><div align="center" class="style10 style14 style14"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NO ENDOSABLE</div></td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="2"><div align="center" class="style10 style14 style14">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CADUCA 60 DIAS </div></td>
  </tr>
</table>
<table width="100%"  border="1">
  <tr bordercolor="#FFFFFF">
    <td colspan="2"><span class="style14"><strong>CHEQUE No:&nbsp;&nbsp;&nbsp;&nbsp;<? echo "$registro[2]";?>&nbsp; </strong></span></td>
    <td colspan="2"><p class="style14"><strong>BANCO:&nbsp;&nbsp;&nbsp;&nbsp;<? echo "$registro[3]";?>&nbsp; </strong></p>
      <p class="style14"><strong>CTA. CTE No:&nbsp;&nbsp;&nbsp;&nbsp;<? echo "$registro[4]";?>&nbsp; </strong></p></td>
    <td width="20%"><span class="style14"><strong>FECHA:&nbsp;&nbsp;&nbsp;&nbsp;<? echo "$registro[5]";?>&nbsp; </strong></span></td>
  </tr>
  <tr>
    <td colspan="4"><span class="style14"><strong>PAGADO A:&nbsp; &nbsp;
      <?  echo $regis[0]; ?>
      </strong></span></td>
    <td><span class="style14"><strong>No DE FACTURA:<strong><span class="Estilo1">
      <? while ($factura= mysql_fetch_row($rf)){echo $factura[0].'&nbsp;'; }?>
      </span></strong></strong></span></td>
  </tr>
  <tr>
    <td colspan="5"><span class="style14"><strong>CONCEPTO: &nbsp;<? echo "$registro[7]";?>&nbsp; </strong></span></td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td colspan="5" class="celdatodo style14 style14">&nbsp;</td>
  </tr>
  <tr>
    <td width="22%"><div align="center" class="style14"><strong>CUENTA - C&Oacute;DIGO</strong></div></td>
    <td colspan="2"><div align="center" class="style14"><strong>DETALLE</strong></div></td>
    <td width="12%"><div align="center" class="style14"><strong>DEBITO</strong></div></td>
    <td><div align="center" class="style14"><strong>CREDITO</strong></div></td>
  </tr>
  <? $resu=mysql_query("SELECT cuenta, sum(monto_s) FROM  id_pago WHERE cod_p='$registro[0]' group by cuenta",$conexion);

	while ($reg= mysql_fetch_row($resu)) {
	
	if($reg[0]=="4.03.18.01.00" and $reg[1]==0){	
	}
	else {?>
  <tr bordercolor="#FFFFFF">
    <td class="celdaright"><div align="center" class="style14"><? echo "$reg[0]";?></div></td>
    <td colspan="2" class="celdaright"><span class="style14">
      <? $re=mysql_query("SELECT * FROM  cuenta_gen WHERE cuenta='$reg[0]'",$conexion);

	$cuenta= mysql_fetch_row($re);	 echo "$cuenta[1]";?>
      </span></td>
    <td align="right" class="celdaright"><span class="style14">
      <? 
	
	$debito= number_format($reg[1],2,",",".");
	
	echo "$debito";?>
    </span></td>
    <td align="right" class="celdatodo style14 style14">&nbsp;</td>
  </tr>
  <? } }
  
    $r=mysql_query("SELECT sum(monto_s) FROM  id_pago WHERE cod_p='$registro[0]'",$conexion);
	$credito= mysql_fetch_row($r); ?>
  <tr bordercolor="#FFFFFF">
    <td class="celdaright"><div align="center" class="style14">1</div></td>
    <td colspan="2" class="celdaright"><span class="style14">BANCO, CTA CORRIENTE</span></td>
    <td align="right" class="celdaright style14 style14">&nbsp;</td>
    <td align="right" class="celdatodo"><span class="style14">
      <? 
	
	$cred= number_format($credito[0],2,",",".");
	
	echo $cred; ?>
      </span> </td>
  </tr>
  <tr>
    <td colspan="3"><div align="right" class="style14"><strong>TOTALES</strong></div></td>
    <th align="right"><span class="style14"><? echo $cred; ?></span></th>
    <th align="right"><span class="style14"><? echo $cred; ?></span></th>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td colspan="2" class="celdatodo"><span class="style14"><strong>REALIZADO POR: </strong></span></td>
    <td width="22%" class="celdatodo style14 style14">REVISADO POR:</td>
    <td colspan="2" class="celdatodo"><span class="style14"><strong>APROBADO POR:</strong></span></td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td colspan="2" class="celdatodo style14 style14">&nbsp;</td>
    <td class="celdatodo style14 style14">&nbsp;</td>
    <td colspan="2" class="celdatodo style14 style14">&nbsp;</td>
  </tr>
  <tr align="right" bordercolor="#FFFFFF">
    <td height="22" colspan="2" class="celdatodo"><div align="left"><span class="style14">&nbsp;</span><span class="style14"><? echo "$registro[12]";?></span></div></td>
    <td class="celdatodo style14 style14"><div align="left"><span class="style14"><? echo "$registro[9]";?></span></div></td>
    <td colspan="2" class="celdatodo"><div align="left"><span class="style14"><? echo "$registro[10]";?>&nbsp;&nbsp;</span></div></td>
  </tr>
  <tr align="right" bordercolor="#FFFFFF">
    <td height="20" colspan="2" class="celdatodo"><p align="left" class="style14">&nbsp;Asistente&nbsp;&nbsp;&nbsp;&nbsp;</p></td>
    <td class="celdatodo style14 style14"><div align="left"><span class="style14">Administradora&nbsp;&nbsp;&nbsp;&nbsp;</span></div></td>
    <td colspan="2" class="celdatodo"><p align="left" class="style14">Jefe de la Unidad&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p></td>
  </tr>
  <tr bordercolor="#FFFFFF">
    <td colspan="5" bordercolor="#000000"><span class="style14"><strong>RECIBIDO POR: </strong></span></td>
  </tr>
  <tr bordercolor="#FFFFFF" class="celdatodo">
    <td colspan="5" class="celdatodo"><span class="style14"><strong>Nombre: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  </strong></span></td>
  </tr>
  <tr bordercolor="#FFFFFF" class="celdatodo">
    <td colspan="5" class="celdatodo"><span class="style14"><strong>N&ordm; de C.I. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  </strong></span></td>
  </tr>
  <tr bordercolor="#FFFFFF" class="celdatodo">
    <td colspan="5" class="celdatodo"><strong class="celdatodo style14 style14">Firma y Sello: </strong></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</HTML>
